﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Windows.Media.Animation;

namespace BlueMarble.Genesis.Infrastructure.Background.Default
{
    /// <summary>
    /// Interaction logic for InformationAmbience.xaml
    /// </summary>
    public partial class InformationAmbience : UserControl
    {
        protected Random random;
        protected DispatcherTimer timer;

        public InformationAmbience()
        {
            InitializeComponent();

            Storyboard animation = this.Resources["MainTitleStoryBoard"] as Storyboard;

            animation.Begin();

            random = new Random();
            timer = new DispatcherTimer();

            timer.Interval = new TimeSpan(0, 0, 30);
            timer.Tick += new EventHandler(timer_Tick);

            timer.Start();
        }

        void timer_Tick(object sender, EventArgs e)
        {
            timer.Stop();

            int function = random.Next(2);

            switch (function)
            {
                case 0:
                    Storyboard animation = this.Resources["BasicInformationStoryBoard"] as Storyboard;

                    animation.Begin();
                    break;
                case 1:
                    break;
                case 2:
                    break;
                default:
                    break;
            }

            timer.Interval = new TimeSpan(0, random.Next(3), 0);
            timer.Start();
        }
    }
}
